<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面1</title>
</head>
<body>
<h1>页面1</h1>
<span id="username"></span>登录了
</body>
<script src="../../lib/jquery-3.6.0.js"></script>
<script>

    var user = localStorage.getItem("user");
    user = JSON.parse(user);//json的反序列化，把字符串变成json对象

    $('#username').text(user.username);
</script>
</html>